

function renommeJoueur(identifiant,name)
{
	document.getElementById(identifiant).innerHTML = '<div ><input type="text" value="'+document.getElementById(name).value+'" id="changeNom" onBlur="afficheNom(\''+identifiant+'\',\''+name+'\')"></div>';
}

function afficheNom(identifiant,name)
{
	//alert(name);
	//alert(document.getElementById(name).value);
	document.getElementById(name).value = document.getElementById('changeNom').value;
	//alert(document.getElementById(name).value);
	document.getElementById(identifiant).innerHTML = '<div  onclick="renommeJoueur(\''+identifiant+'\')">'+document.getElementById("changeNom").value+'</div>';
}

function detailCarte(url,description)
{
	var contenu = "";
	contenu += "<div class=\"affichageDetail\" onClick=\"fermeDetailCarte();\">";
	contenu += "	<div class=\"affichageDetailOpaque\">";
	contenu += "		<table><tr>";
	contenu += "			<td><img SRC=\"./image/"+url+"\" /></td>";
	contenu += "			<td ><span style=\"font-size:19pt\">"+description+"</span></td>";
	contenu += "		</tr></table>";
	contenu += "	</div>";
	contenu += "	<div class=\"affichageDetailTranslucide\">";
	contenu += "	</div>";
	contenu += "</div>";
	document.getElementById("detailCarte").innerHTML = contenu;
}

function marcheNoir(url1,nom1,url2,nom2,url3,nom3)
{

	var contenu = "";
	contenu += "<div class=\"affichageDetail\">";
	contenu += "	<div class=\"affichageDetailOpaque\">";
	contenu += "		<div class=\"fermer\" onClick=\"aucunAchat('"+nom1+"','"+nom2+"','"+nom3+"');\">x fermer</div>";
	contenu += "		<table><tr>";
	contenu += "			<td><img SRC=\"./image/"+url1+"\"  onClick=\"choixCarte('"+nom1+"','"+nom2+"','"+nom3+"');\" />&nbsp;&nbsp;&nbsp;&nbsp;</td>";
	contenu += "			<td><img SRC=\"./image/"+url2+"\"  onClick=\"choixCarte('"+nom2+"','"+nom1+"','"+nom3+"');\" />&nbsp;&nbsp;&nbsp;&nbsp;</td>";
	contenu += "			<td><img SRC=\"./image/"+url3+"\"  onClick=\"choixCarte('"+nom3+"','"+nom1+"','"+nom2+"');\" /></td>";
	contenu += "		</tr></table>";
	contenu += "	</div>";
	contenu += "	<div class=\"affichageDetailTranslucide\">";
	contenu += "	</div>";
	contenu += "</div>";
	document.getElementById("detailCarte").innerHTML = contenu;
}

function fermeDetailCarte()
{
	document.getElementById("detailCarte").innerHTML = "";
}

function choixCarte(nomChoisi,nomRejete1,nomRejete2)
{
	if(confirm('Tu veux bien acheter la carte: '+nomChoisi+' ?'))
	{
		var nomChoisiTxt = document.createElement("input");
		nomChoisiTxt.setAttribute("type", "hidden");
		nomChoisiTxt.setAttribute("name", "nomChoisi");
		nomChoisiTxt.setAttribute("value", nomChoisi);

		var nomRejete1Txt = document.createElement("input");
		nomRejete1Txt.setAttribute("type", "hidden");
		nomRejete1Txt.setAttribute("name", "nomRejete1");
		nomRejete1Txt.setAttribute("value", nomRejete1);

		var nomRejete2Txt = document.createElement("input");
		nomRejete2Txt.setAttribute("type", "hidden");
		nomRejete2Txt.setAttribute("name", "nomRejete2");
		nomRejete2Txt.setAttribute("value", nomRejete2);

		var outForm = document.createElement("form");
		outForm.setAttribute("method", "post");
		outForm.setAttribute("action", "");
		outForm.appendChild(nomChoisiTxt);
		outForm.appendChild(nomRejete1Txt);
		outForm.appendChild(nomRejete2Txt);

		document.body.appendChild(outForm);
		outForm.submit();
	}
}

function aucunAchat(nomChoisi,nomRejete1,nomRejete2)
{
		var pasdachatTxt = document.createElement("input");
		pasdachatTxt.setAttribute("type", "hidden");
		pasdachatTxt.setAttribute("name", "pasdachat");
		pasdachatTxt.setAttribute("value", "Pas Achat");

		var nomChoisiTxt = document.createElement("input");
		nomChoisiTxt.setAttribute("type", "hidden");
		nomChoisiTxt.setAttribute("name", "nomChoisi");
		nomChoisiTxt.setAttribute("value", nomChoisi);

		var nomRejete1Txt = document.createElement("input");
		nomRejete1Txt.setAttribute("type", "hidden");
		nomRejete1Txt.setAttribute("name", "nomRejete1");
		nomRejete1Txt.setAttribute("value", nomRejete1);

		var nomRejete2Txt = document.createElement("input");
		nomRejete2Txt.setAttribute("type", "hidden");
		nomRejete2Txt.setAttribute("name", "nomRejete2");
		nomRejete2Txt.setAttribute("value", nomRejete2);

		var outForm = document.createElement("form");
		outForm.setAttribute("method", "post");
		outForm.setAttribute("action", "");
		outForm.appendChild(pasdachatTxt);
		outForm.appendChild(nomChoisiTxt);
		outForm.appendChild(nomRejete1Txt);
		outForm.appendChild(nomRejete2Txt);

		document.body.appendChild(outForm);
		outForm.submit();
}